package com.example.lt.entity.video;

import com.baomidou.mybatisplus.annotation.TableField;
import com.example.lt.entity.BaseEntity;
import lombok.*;

import javax.validation.constraints.NotBlank;
import java.util.Arrays;
import java.util.List;

/**
 * @Author 小涛Tao
 * @Date: 2024/08/03/18:44
 * version 1.0 注释：分类,隐藏视频标签
 **/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class Type extends BaseEntity {

    private static final long serialVersionUID = 1L;

    @NotBlank(message = "分类名称不可为空")
    private String name;

    // 分类的描述
    private String description;

    // 分类的封面
    private String icon;

    // 是否公开
    private Boolean open;

    // 分类标签
    private String labelNames;

    // TODO 暂时不知道
    private Integer sort;

    // 用户是否订阅
    @TableField(exist = false)
    private Boolean used;

    public List<String> buildLabel() {
        return Arrays.asList(labelNames.split(","));
    }

}
